#pragma once

#include <list>
#include <vector>

using namespace std;

class CTreeSelectionSort
{
public:
	CTreeSelectionSort(void);
	~CTreeSelectionSort(void);

public:
	void pushDataToPool(const int i);
	void eraseDataInPool(const int i);
	void clearDataPool();

	void DoSort();
	int GetList(list<int>& out_list);

private:
	void _DoSortLoop();
	int _GetMiniNumber(vector<int>& vNumberPool);

	void debugPrint();

private:
	struct double_node
	{
		double_node* m_pNextLeft;
		double_node* m_pNextRight;
		double_node* m_pPrev;
		int m_ivalue;
		int m_iLevel;
		vector<int>::iterator itPosInSn;
		
		double_node()
		{
			m_pNextLeft = 0;
			m_pNextRight = 0;
			m_pPrev = 0;
			m_ivalue = 0;
			m_iLevel = 0;
		}
	};

private:
	vector<int> m_viPool;
	vector<int> m_vSortVector;
};

